import React, { useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import { getArticleList } from "@/store/counterSlice.js";
import instance from "../../apis/request";
import { ArticleList } from "../../apis/index";
function Home() {
  const [datas, setDatas] = useState([]);
  const [params, setParams] = useState({});
  //   const articleList = useSelector(state => state.counter.articleList)
  // const dispatch = useDispatch()
  const dd = async () => {
    try {
      const res = await ArticleList(datas);
      setDatas(res.data.rows);
      console.log(res.data.rows);
      
    } finally {

    }
  };
  useEffect(() => {
    dd();
    console.log(datas);
  }, [params]);

  // useEffect(()=>{
  //   ArticleList(params).then(res=>{
  //     console.log(res.data.rows);
  //     setDatas(res.data.rows)
  //   })
  // },[])

  return (
    <div>
      212121
      <ul>

      
      {datas &&
        datas.map((item, index) => {
          return <li style={{marginTop:"10px"}} key={index}>{item.title}</li>;
        })}</ul>
      {/* <div>{datas[1].title}</div> */}
    </div>
  );
}

export default Home;
